package com.spider.common.task.controller;

import com.spider.common.bean.tender.TenderSearchVo;
import com.spider.common.task.service.TenderTask;
import com.spider.common.utils.ExportToUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * @author marver
 * @Description
 * @date 2019/4/9 14:42
 */
@RestController
public class TenderController {
    @Autowired
    private TenderTask tenderTask;
    /**
     * 招标采集
     * @param searchVo
     */
    @RequestMapping("/tenderGrab")
    public void tenderGrab(HttpServletRequest request, HttpServletResponse response, TenderSearchVo searchVo){
        List<Map<String, Object>> list = tenderTask.getTenderData(searchVo);

        String[] cellValues={"招标公告","详情页URl"};
        String[] titlename={"title","titleUrl"};
        Integer[] columnWidths={88,88};
        ExportToUtils.createExcel(request,response, "招标公告列表", columnWidths, cellValues, list, titlename);
    }
}
